<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
	<head>
		<title>新增信息</title>
		
		<script type="text/javascript">
		$(function(){
			var IsOK = true;
			$("#sub").click(function(){
				if(IsOK){
					return true;
				}else{
					return false;
				}
				return true;
			});
			
			$(".userId").blur(function(){
				var id = $(this).val();
				var message = $(".info");
				message.val("");
				$.post("checkID",
						{'id':id},
						function(data){
						    if(data.falg){
						    }else{
						    	IsOK = false;
						    	message.val("该ID已存在");
						    }
					  },
					  'json'
				);
			});
			$('#userForm .gender').val('0');
			$('#userForm .sex').click(function(){
				var gender = $('#userForm input[name="gender"]:radio:checked').val();
				$('#userForm .gender').val('');
				$('#userForm .gender').val(gender);
			});
		})
		
		</script>
	</head>

	<body>

			<!-- /section:settings.box -->
			<div class="page-content-area">
				<div class="page-header">
					<ul class="breadcrumb">
                              <li>
                                  <i class="ace-icon fa fa-home home-icon"></i>
                                  <a href="#"><spring:message code="user.Admin.message"/></a>
                              </li>
                          </ul>
				</div><!-- /.page-header -->

				<div class="row">
					<div class="col-xs-12">
						<!-- PAGE CONTENT BEGINS -->
						<form:form id="userForm" class="form-horizontal" role="form" action="add" method="post" modelAttribute="user">
							<!-- #section:elements.form -->
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> <spring:message code="user.id.message"/> </label>

								<div class="col-sm-9">
									<form:input path="userId" type="text" id="form-field-1" placeholder="ID" class="col-xs-10 col-sm-3 userId" /><form:errors path="userId" cssClass="error info" cssStyle="color:red"/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> <spring:message code="user.name.message"/> </label>

								<div class="col-sm-9">
									<form:input path="userName" type="text" id="form-field-1" placeholder="Name" class="col-xs-10 col-sm-3" /><form:errors path="userName" cssClass="error" cssStyle="color:red"/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> <spring:message code="user.gender.message"/> </label>

								<div class="col-sm-9">
									<form:input path="gender" type="hidden" class="gender"/>
									<input class="sex" type="radio" name="gender" value="0" checked/><spring:message code="user.male.message"/>&nbsp;&nbsp;<input class="sex" type="radio" name="gender" value="1"/><spring:message code="user.female.message"/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> <spring:message code="user.birthday.message"/> </label>

								<div class="col-sm-9">
									<%@include file="/WEB-INF/view/common/date.jsp"%>
									<form:input path="birthday" type="text" id="form-field-1" placeholder="yyyy-mm-dd" class="col-xs-10 col-sm-3 date" /><form:errors path="birthday" cssClass="error" cssStyle="color:red"/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> <spring:message code="user.tel.message"/> </label>

								<div class="col-sm-9">
									<form:input path="tel" type="text" id="form-field-1" placeholder="Tel" class="col-xs-10 col-sm-3" /><form:errors path="tel" cssClass="error" cssStyle="color:red"/>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> <spring:message code="user.address.message"/> </label>

								<div class="col-sm-9">
									<form:input path="address" type="text" id="form-field-1" placeholder="Address" class="col-xs-10 col-sm-3" /><form:errors path="address" cssClass="error" cssStyle="color:red"/>
								</div>
							</div>

							<div class="clearfix form-actions">
								<div class="col-md-offset-3 col-md-9">
									<button id="sub" class="btn btn-info" type="submit">
										<i class="ace-icon fa fa-check bigger-110"></i>
										<spring:message code="user.submit.message"/>
									</button>

									&nbsp; &nbsp; &nbsp;
									<button class="btn" type="reset">
										<i class="ace-icon fa fa-undo bigger-110"></i>
										<spring:message code="user.reset.message"/>
									</button>
								</div>
							</div>

						</form:form>
					</div><!-- /.col -->
				</div><!-- /.row -->
			</div><!-- /.page-content-area -->

	</body>
</html>
